(:
  A procedure to select the contents of the "chat" interventions
:)
declare boundary-space strip;
import module namespace
    jj = "http://kumquat.emse.fr/utilitaires"
    at "jjutils.xq" ;
<display>{
let $t := $arguments[1]
let $d := doc($t)/*/*
for $e at $p in $d
where $p < 1000
return
  <item>{
    <info name="tool">wikiplayer</info>,
    <info name="type">{ xs:string($e/@type) }</info> ,
    <info name="time"><time><date>{ xs:integer($e/@timestamp) }</date><duration>0</duration></time></info>,
    <info name="src-anchor">{
      <anchor>{
        <doc>{ $t }</doc>,
        <path>{jj:build-Path($e)}</path>
      }</anchor>
    }</info>,
    <info name="user">{string($e/@user)}</info>,
    <info name="item-kind">{string($e/*[1]/@kind)}</info>,
    <info name="item-type">{string($e/*[1]/@type)}</info>,
    <info name="item-owner">{string($e/*[1]/@owner)}</info>,
    <info name="item-text">{string($e/*[1]/@text)}</info>,
    <info name="content">{string($e/*[1]/*/text())}</info>,
    <info name="to-item-kind">{string($e/*[2]/@kind)}</info>,
    <info name="to-item-type">{string($e/*[1]/@type)}</info>,
    <info name="to-item-owner">{string($e/*[1]/@owner)}</info>,
    <info name="to-item-text">{string($e/*[1]/@text)}</info>
  }</item>
}</display>
